VSMEX version 1.0, for Visual studio 2010 and 2012, windows

Author: Stefan Karlsson
December 2013

----------------------------
1 Installation:

  1.1 Download and install the "visual studio sdk"

      VS 2010:
      http://www.microsoft.com/en-us/download/details.aspx?id=2680

      VS 2012:
      http://www.microsoft.com/en-us/download/details.aspx?id=30668

  1.2 double click the file "Matlab Tools.vsix" 

  1.3 Open VS, go "Tools->Options->Matlab Tools" and enter the path to the Matlab executable you want to use
      (e.g "C:\Program Files\MATLAB\R2013a\bin\win64\MATLAB.exe")



_______________ note _________________
If it is the first time that you use Matlab MEX:

you will also need to setup Matlab for MEX. Start Matlab, type:
mex -setup

this should enable you to set your version of visual studio as the compiler.

----------------------------



2 Description: 

VSMEX is a MS visual studio (2010 and 2012) extension (similar to a plugin/addin) that extends functionality for Matlab mex interfacing. It has been tested for C/C++ but should work equally well for other languages (Fortran etc).

Current version supports visual studio 2010 and 2012.

It installs menu options in VS, as well as an optional toolbox interface. It consists of 4 buttons/interface methods:

Run
RunFast
Debug
View

2.1 Run
Opens a thin client of Matlab(fast with small memory overhead), compiles the currently selected source file as MEX, and runs it.

2.2 RunFast
Same as "RUN" but with an even thinner client of Matlab without JAVA engine (extremely fast with tiny memory overhead). Many matlab functions are disabled in this mode, such as most visualizations. However, the core engine works and is suitable for most numerical implementations

2.3 Debug
Same as "RUN", but builds for debug, instead of release. If any break-points were set in the code in VS, then this option also starts the Microsoft debugger and attaches it to the Matlab session. This provides full debugging capability as you run the code from Matlab.

2.4  View
Opens the M-file for your source code development. If there is no M-file for your source code, then VSMEX will create a generic one for you, and open that one in your default editor. (its a good idea to setup a default viewer of m-files for windows, other than Matlab, I recommend the tiny program "notepad++": http://notepad-plus-plus.org/)

The M-file is where you:
a) setup the compilation of your c-code (link to additional libraries for example)
b) run the mex binary (including setting up the call with generation of some reasonable input/output data)


-----------------
Known issues:

slow running times:
May be caused by network licensing of Matlab that is setup ineffeciently. You will not want Matlab to do a lengthy licence check each time you open it. If you have a stand alone licence, you are definetly safe.

cant write to mex file:
If you have a Matlab session running, you will lock your mex binaries when you use them. This will stop VSMEX from modifying them. To solve this, in your Matlab session type "clear mex" to release the binaries (this also clears all persistent data in your mex modules).